#ifndef ADCDRIVER_H_
#define ADCDRIVER_H_
/************************************************************************************
*	Copyright Paxs Electronics 2012													*
*   All Rights Reserved																*
*   The Copyright symbol does not also indicate public availability or publication.	*
* 																					*
* 								PAXS ELECTRONICS									*
* 																					*
* - Driver:   			ADC Driver						 							*
* 																					*
* - Compiler:           Code Composer Studio (Licensed)								*
* - Supported devices:  All Stellaris Family Cortex-M3.								*
* - AppNote:																		*
*																					*
* 	Created by: 		Juan Francisco Gomez Ruiz									*
*   Date Created: 		21 - JUN - 2012												*
*   Contac				pacoduz@gmail.com											*
* 																					*
* 	Description: 		Handle Functions to driver the ADC module and,				*
* 						ADC opreations mode Configurations.							* 					
*   Device supported and tested: - LM3S5749 - LM3S3748 -							*
* 																				2012*
*************************************************************************************

*************************************************************************************
* 	Revision History:
*
*   Date          CP#           Author
*   MM-DD-YY      XXXXX:1       Initials   Description of change
*   -----------   -----------   --------   ------------------------------------
*    06-21-12      	1.0             JFGR	Initial version. 

*************************************************************************************
*
* File/
*	Functional Description:
* 	The Stellaris ADC collects sample data by using a programmable sequence-based approach instead
*	of the traditional single or double-sampling approaches found on many ADC modules. Each sample
*	sequence is a fully programmed series of consecutive (back-to-back) samples, allowing the ADC
*	to collect data from multiple input sources without having to be re-configured or serviced by the
*	controller. The programming of each sample in the sample sequence includes parameters such as
*	the input source and mode (differential versus single-ended input), interrupt generation on sample
*	completion, and the indicator for the last sample in the sequence.
* 
*/
	#include "lm3s5749.h"
	#include "inc/hw_types.h"
	#include "inc/hw_adc.h"
	#include "inc/hw_memmap.h"
	#include "hw_ints.h"
	#include "driverlib/gpio.h"
	#include "driverlib/interrupt.h"
	#include "driverlib/sysctl.h"
	#include "driverlib/adc.h"

/******************************************************************************
*							 MACRO DEFINITIONS
******************************************************************************/	
	#define ON						1
	#define OFF						0
	#define TRIGGER_ALWAYS			0
	#define TRIGGER_PROCESSOR		1
	#define TRIGGER_TIMER			2
	#define TRIGGER_PWM				3
	//SS Stands for Smaple Sequencer
	#define SS0_ENABLE				(OFF)	//Number of Samples: 8
	#define SS1_ENABLE				(ON)	//Number of Samples: 4
	#define SS2_ENABLE				(ON)	//Number of Samples: 4
	#define SS3_ENABLE				(ON)	//Number of Samples: 1
	#define SS0_TRIGGER				(TRIGGER_PROCESSOR)
	#define SS1_TRIGGER				(TRIGGER_PROCESSOR)
	#define SS2_TRIGGER				(TRIGGER_PROCESSOR)
	#define SS3_TRIGGER				(TRIGGER_PROCESSOR)
	#define INTERNAL_TEMPERATURE	(ON)
	
	//	CHANNLES READ IT BY SEQUENCER 0	//
	#define ADC_CHANNEL0			(ON)	// MaxSonar Voltage 
	#define ADC_CHANNEL1			(ON)	// Battery Voltage
	#define ADC_CHANNEL2			(ON)	// Internal Temperature Sensor
	//	CHANNLES READ IT BY SEQUENCER 1	//
	//	CHANNLES READ IT BY SEQUENCER 2	//
	//	CHANNLES READ IT BY SEQUENCER 3	//

/******************************************************************************
*   					PUBLIC FUNCTIONS DEFINITIONS
******************************************************************************/
	void VfnADCInitialization(void); 
	
	void VfnADCSequencer0Read(unsigned long *datoADC_ptr);
	void VfnADCSequencer1Read(unsigned long *datoADC_ptr);
	// **NOTE -> ADC Sequencer Results are available when an ADC Trigger Interrups occurs
#endif /*ADCDRIVER_H_*/
